package xyz.prob.kun.base.security.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import xyz.prob.kun.security.mapper.MyUserMapper;
import xyz.prob.kun.security.model.LoginUser;
import xyz.prob.kun.security.model.MyUser;

@Component("userDetailServiceImpl")
public class UserDetailServiceImpl implements UserDetailsService {
    @Resource
    private MyUserMapper myUserMapper;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        MyUser myUser = myUserMapper.selectOne(Wrappers.<MyUser>lambdaQuery().eq(MyUser::getLoginName, username));
        LoginUser loginUser = new LoginUser();
        return loginUser;
    }
}
